﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FarseerGames.FarseerPhysics;
using FarseerGames.FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace XNA_2DFramwork
{
    public class Shoot:VisualObject
    {
        private Vector2 _origin;
        public Shoot(Game Game, PhysicsSimulator PS,GraphicsDevice graphicsDevice,Vector2 Pos)
            : base(Game)
        {
            PS = new PhysicsSimulator(new Vector2(0, 0));
            PhysicsSimulator = PS;
            SpriteBatch = new SpriteBatch(graphicsDevice);
            Texture = DemoBaseXNA.DrawingSystem.DrawingHelper.CreateCircleTexture(graphicsDevice, 3, Color.TransparentBlack);
            _origin = new Vector2(Texture.Width / 2f, Texture.Height / 2f);
            Body = BodyFactory.Instance.CreateCircleBody(PhysicsSimulator, 3, 200005f);
            Position = Pos;
            Body.Position = Position;

            Geom = GeomFactory.Instance.CreateCircleGeom(PhysicsSimulator, Body, 3, 100);
            Geom.CollisionResponseEnabled = false;
        }

        public override void Draw()
        {
            SpriteBatch.Begin();
            SpriteBatch.Draw(Texture, Geom.Position, null, Color.Black, Body.Rotation, _origin, 1f, SpriteEffects.None, 0f);
            SpriteBatch.End();
        }

        public override void Update()
        {
                 
        }
    }
}
